﻿using System;
using housingsafety.server.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
using SixLabors.ImageSharp;

namespace housingsafety.server.Entities.DataModels
{
    public partial class BaseDbContext : DbContext
    {
        public BaseDbContext()
        {
        }

        public BaseDbContext(DbContextOptions<BaseDbContext> options)
            : base(options)
        {
        }



        public virtual DbSet<ZmDepartment> ZmDepartment { get; set; }
        public virtual DbSet<ZmFileAttach> ZmFileAttach { get; set; }
        public virtual DbSet<ZmLoginLog> ZmLoginLog { get; set; }

        public virtual DbSet<ZmBuildings> ZmBuildings { get; set; }
        public virtual DbSet<Jcztnum> Jcztnum { get; set; }

        public virtual DbSet<ZmPcYhLogDxDto> ZmPcYhLogDxDto { get; set; }

        public virtual DbSet<ZmPcYhLogDxZgDto> ZmPcYhLogDxZgDto { get; set; }


        public virtual DbSet<ZmPcYhlogDxzgsonCj> ZmPcYhlogDxzgsonCj { get; set; }

        public virtual DbSet<ZmPcYhlogDxzgsonSqjz> ZmPcYhlogDxzgsonSqjz { get; set; }
        public virtual DbSet<ZmPcYhLogDx> ZmPcYhLogDx { get; set; }

        public virtual DbSet<ZmPcYhLogDxCj> ZmPcYhLogDxCj { get; set; }

        public virtual DbSet<ZmPcYhLogDxSqjz> ZmPcYhLogDxSqjz { get; set; }
        public virtual DbSet<ZmPcYhLogDxDtoXq> ZmPcYhLogDxDtoXq { get; set; }
        public virtual DbSet<ZmPcYhLogDxZgDtoCj> ZmPcYhLogDxZgDtoCj { get; set; }
        public virtual DbSet<ZmPcYhLog> ZmPcYhLog { get; set; }
        public virtual DbSet<ZmPcYh> ZmPcYh { get; set; }

        public virtual DbSet<ZmPcYhLogCj> ZmPcYhLogCj { get; set; }
        public virtual DbSet<ZmPcYhLogSqjz> ZmPcYhLogSqjz { get; set; }
        public virtual DbSet<ZmPcYhCj> ZmPcYhCj { get; set; }
        public virtual DbSet<ZmPcYhSqjz> ZmPcYhSqjz { get; set; }

        public virtual DbSet<ZmTaskDetail> ZmTaskDetail { get; set; }
        public virtual DbSet<ZmPcBase> ZmPcBase { get; set; }

        public virtual DbSet<ZmPcBaseCj> ZmPcBaseCj { get; set; }

        public virtual DbSet<ZmPcBaseSqjz> ZmPcBaseSqjz { get; set; }
        public virtual DbSet<ZmPcBaseLog> ZmPcBaselog { get; set; }

        public virtual DbSet<ZmPcBaseLogCj> ZmPcBaselogCj { get; set; }

        public virtual DbSet<ZmPcBaseLogSqjz> ZmPcBaseLogSqjz { get; set; }
        public virtual DbSet<ZmBuildingsDto> ZmBuildingsDto { get; set; }
        public virtual DbSet<ZmPcYhLogCjDto> ZmPcYhLogCjDto { get; set; }

        public virtual DbSet<CountClass> CountClass { get; set; }

        public virtual DbSet<ZmPcYhLogAllDto> ZmPcYhLogAllDto { get; set; }
        public virtual DbSet<FwlbCount> FwlbCount { get; set; }


        public virtual DbSet<Fwlb_Fwzt> Fwlb_Fwzt { get; set; }
        public virtual DbSet<FwlbDto> FwlbDto { get; set; }

        public virtual DbSet<MyHouseDtoYJ> MyHouseDtoYJ { get; set; }

        public virtual DbSet<MyHouseDtoYJREsult> MyHouseDtoYJREsult { get; set; }

        
        public virtual DbSet<MyHouseDto> MyHouseDto { get; set; }
        public virtual DbSet<ZmSystemLog> ZmSystemLog { get; set; }
        public virtual DbSet<ZmUser> ZmUser { get; set; }
        public virtual DbSet<ZmSql> ZmSql { get; set; }
        public virtual DbSet<ZmPcGjzzCj> ZmPcGjzzCj { get; set; }

        public virtual DbSet<ZmBuildingLedger> ZmBuildingLedger { get; set; }
        public virtual DbSet<ZmPcGjzzCjTj> ZmPcGjzzCjTj { get; set; }

        public virtual DbSet<ZmVillage> ZmVillage { get; set; }
        public virtual DbSet<ZmUserToken> ZmUserToken { get; set; }


        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
            }
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {

            modelBuilder.Entity<CountClass>().HasNoKey();
            modelBuilder.Entity<FwlbCount>().HasNoKey();

            modelBuilder.Entity<ZmVillage>().HasNoKey();

            modelBuilder.Entity<ZmPcYhLogCjDto>().HasNoKey();

            modelBuilder.Entity<MyHouseDto>().HasNoKey();

            modelBuilder.Entity<MyHouseDtoYJ>().HasNoKey();
            
            modelBuilder.Entity<MyHouseDtoYJREsult>().HasNoKey();
            modelBuilder.Entity<Jcztnum>().HasNoKey();

            modelBuilder.HasPostgresExtension("postgis");

            modelBuilder.Entity<ZmDepartment>(entity =>
            {
                entity.Property(e => e.CreateIp).HasComment("创建时的IP");

                entity.Property(e => e.CreateOn).HasComment("创建时间");

                entity.Property(e => e.DeleteBy).HasComment("删除者");

                entity.Property(e => e.DeleteIp).HasComment("删除时的IP");

                entity.Property(e => e.Check107).HasComment("1=Y| 0=N");

                entity.Property(e => e.DeleteOn).HasComment("删除时间");

                entity.Property(e => e.IsDelete).HasComment("是否删除");

                entity.Property(e => e.ModifiedBy).HasComment("修改者");

                entity.Property(e => e.ModifiedIp).HasComment("修改时的IP");

                entity.Property(e => e.ModifiedOn).HasComment("修改时间");
            });

            modelBuilder.Entity<ZmPcGjzzCj>(entity =>
            {
                // 配置 Id 字段为自增主键
                entity.Property(e => e.Id)
                    .ValueGeneratedOnAdd();

                // 其他字段的配置...

                // 如果有其他配置，请在这里添加
            });

            modelBuilder.Entity<ZmFileAttach>(entity =>
            {
                entity.HasComment("文件附表");

                entity.Property(e => e.Id).HasComment("ID");

                entity.Property(e => e.ContentLength).HasComment("大小");

                entity.Property(e => e.ContentName).HasComment("名称");

                entity.Property(e => e.ContentType).HasComment("类型");

                entity.Property(e => e.CreateBy).HasComment("创建者");

                entity.Property(e => e.CreateIp).HasComment("创建时的IP");

                entity.Property(e => e.CreateOn).HasComment("创建时间");

                entity.Property(e => e.DeleteBy).HasComment("删除者");

                entity.Property(e => e.DeleteIp).HasComment("删除时的IP");

                entity.Property(e => e.DeleteOn).HasComment("删除时间");

                entity.Property(e => e.IsDelete).HasComment("是否删除");

                entity.Property(e => e.ModifiedBy).HasComment("修改者");

                entity.Property(e => e.ModifiedIp).HasComment("修改时的IP");

                entity.Property(e => e.ModifiedOn).HasComment("修改时间");

                entity.Property(e => e.ValueText)
                    .HasDefaultValueSql("0")
                    .HasComment("值");
            });

            modelBuilder.Entity<ZmLoginLog>(entity =>
            {
                entity.HasComment("登录记录");

                entity.Property(e => e.Id).HasComment("id");

                entity.Property(e => e.CreateBy).HasComment("登录者");

                entity.Property(e => e.CreateIp).HasComment("登录时的IP");

                entity.Property(e => e.CreateOn).HasComment("登录时间");

                entity.Property(e => e.DeleteBy).HasComment("删除者");

                entity.Property(e => e.DeleteIp).HasComment("删除ip");

                entity.Property(e => e.DeleteOn).HasComment("删除时间");

                entity.Property(e => e.Descr).HasComment("描述");

                entity.Property(e => e.IsDelete).HasComment("是否删除");

                entity.Property(e => e.ModifiedBy).HasComment("修改者");

                entity.Property(e => e.ModifiedIp).HasComment("修改时IP");

                entity.Property(e => e.ModifiedOn).HasComment("修改时间");
            });







            modelBuilder.Entity<ZmSystemConfig>(entity =>
            {
                entity.HasComment("配置表");

                entity.Property(e => e.Id).HasComment("配置id");

                entity.Property(e => e.CreateOn).HasComment("创建时间");

                entity.Property(e => e.DeleteOn).HasComment("删除时间");

                entity.Property(e => e.Desc).HasComment("配置简介");

                entity.Property(e => e.IsDelete).HasComment("是否删除");

                entity.Property(e => e.ModifiedOn).HasComment("修改时间");

                entity.Property(e => e.Name).HasComment("名称");

                entity.Property(e => e.Value).HasComment("值");
            });

            modelBuilder.Entity<ZmSystemLog>(entity =>
            {
                entity.HasComment("操作记录表");

                entity.Property(e => e.Id).HasComment("操作记录ID");

                entity.Property(e => e.CreateOn).HasComment("创建时间");

                entity.Property(e => e.DeleteOn).HasComment("删除时间");

                entity.Property(e => e.Ip).HasComment("登录IP");

                entity.Property(e => e.IsDelete).HasComment("是否删除");

                entity.Property(e => e.LogTime).HasComment("操作时间");

                entity.Property(e => e.LoginType).HasComment("设备类型");

                entity.Property(e => e.ModifiedOn).HasComment("修改时间");

                entity.Property(e => e.Path).HasComment("链接");

                entity.Property(e => e.Respret).HasComment("操作结果");

                entity.Property(e => e.UserId).HasComment("用户id");

                entity.Property(e => e.UserName).HasComment("用户名");

                entity.Property(e => e.MobileBrand).HasComment("手机品牌");

                entity.Property(e => e.MobileSystem).HasComment("手机操作系统");

                entity.Property(e => e.AppVersion).HasComment("APP版本");

                entity.Property(e => e.ErrorStack).HasComment("错误信息及堆栈");
            });

            modelBuilder.Entity<ZmUser>(entity =>
            {
                entity.HasComment("用户表");

                entity.Property(e => e.Id).HasComment("用户ID");

                entity.Property(e => e.SurveyUnitId).HasComment("所属调查单位ID");

                entity.Property(e => e.Avatar).HasComment("用户头像");

                entity.Property(e => e.CreateIp).HasComment("注册时的IP");

                entity.Property(e => e.CreateOn).HasComment("创建时间");

                entity.Property(e => e.DeleteOn).HasComment("删除时间");

                entity.Property(e => e.Descr).HasComment("描述");

                entity.Property(e => e.Disabled).HasComment("是否可用");

                entity.Property(e => e.District).HasComment("行政区");

                entity.Property(e => e.DistrictJson).HasComment("行政区");

                entity.Property(e => e.JurisdictionJson).HasComment("管辖区域");

                entity.Property(e => e.Email).HasComment("邮箱");

                entity.Property(e => e.Encphone).HasComment("加密手机号");

                entity.Property(e => e.Group).HasComment("用户组(住建,消防,公安)");

                entity.Property(e => e.IdCard).HasComment("身份证号");

                entity.Property(e => e.IsDelete).HasComment("是否删除");

                entity.Property(e => e.Jurisdiction).HasComment("管辖区域");

                entity.Property(e => e.Lang).HasComment("语言偏好");

                entity.Property(e => e.LastLoginIp).HasComment("上次登录IP");

                entity.Property(e => e.LastLoginOn).HasComment("上次登录时间");

                entity.Property(e => e.LockEndTime).HasComment("锁定结束时间");

                entity.Property(e => e.LockStartTime).HasComment("锁定起始时间");

                entity.Property(e => e.LoginCount).HasComment("登录次数");

                entity.Property(e => e.ModifiedIp).HasComment("修改时IP");

                entity.Property(e => e.ModifiedOn).HasComment("修改时间");

                entity.Property(e => e.Nickname).HasComment("用户昵称");

                entity.Property(e => e.Number).HasComment("用户编号");

                entity.Property(e => e.Phone).HasComment("用户手机号");

                entity.Property(e => e.Pwd).HasComment("密码=md5(md5(原始密码)+salt)");

                entity.Property(e => e.RoleType).HasComment("角色类型(超级管理员,市级管理员,区县管理员,街道管理员,社区村级管理员,调查员)");

                entity.Property(e => e.Salt).HasComment("密码盐");

                entity.Property(e => e.SysAdmin).HasComment("是否系统后台管理员");

                entity.Property(e => e.SysAdminBy).HasComment("记录被谁授予了后台管理员");

                entity.Property(e => e.SysAdminIp).HasComment("记录授予了后台管理员IP");

                entity.Property(e => e.SysAdminOn).HasComment("记录被授予了后台管理员时间");

                entity.Property(e => e.Uname).HasComment("用户名");
            });

            modelBuilder.Entity<ZmUserToken>(entity =>
            {
                entity.HasComment("用户登录令牌");

                entity.Property(e => e.CreateOn).HasComment("创建时间");

                entity.Property(e => e.DeleteOn).HasComment("删除时间");

                entity.Property(e => e.ExpireTime).HasComment("过期时间");

                entity.Property(e => e.IsDelete).HasComment("是否删除");

                entity.Property(e => e.LoginIp).HasComment("登录ip");

                entity.Property(e => e.LoginType).HasComment("用户登陆类型，h5,app");

                entity.Property(e => e.ModifiedOn).HasComment("修改时间");

                entity.Property(e => e.Token).HasComment("token");

                entity.Property(e => e.UserId).HasComment("用户id");
            });
            OnModelCreatingPartial(modelBuilder);
        }

        partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
    }
}
